/*
 * LoginController.java
 *
 * Copyright 2012 the original author or authors(ninglong).
 *
 * Licensed under the org.geek.login.web, Version 1.0 (the "License");
 *
 */
package org.geek.login.web;

import java.util.List;

import javax.annotation.Resource;

import org.geek.common.entity.Menu;
import org.geek.common.util.TreeUtil;
import org.geek.module.service.IModuleService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * <p></p>
 * @author ninglong bhd2973@qq.com
 * @version V1.0
 */
@Controller
public class LoginController {
	
	@Resource
	private IModuleService moduleService;
	
	@RequestMapping(value="index.jhtml",method = RequestMethod.GET)
	public String login(ModelMap model){
		List<Menu> list = moduleService.getModules2Menu();
		TreeUtil treeMenu = new TreeUtil(list, 1);//id=1为系统菜单
		model.put("nav", treeMenu.getTreeJson().getChildren());
		return "page/index";
	}
}